Skip to content

docs(runtime): give the retention witness its section, and take back the comment that outlived its method - #335

Draft
PhysShell wants to merge 1 commit into
mainfrom
claude/retentionpath-doc-remainder
Draft

docs(runtime): give the retention witness its section, and take back the comment that outlived its method#335
PhysShell wants to merge 1 commit into
mainfrom
claude/retentionpath-doc-remainder

Conversation

@PhysShell

@PhysShell PhysShell commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Closes #334 — the remainder carved out when PR #280 was closed as superseded. Independent of #333: different branch, no shared files, mergeable in any order.

Dominators.cs is not restored, per the issue.

Что и зачем

0753a45 приземлил свидетеля «minus the dominator tree» — решение осознанное и записанное в csproj. Но три вещи остались висеть: <summary> про доминаторы пережил свой метод и стал документацией к Dispose(); RetentionPath оказался единственным из четырёх runtime-инструментов без секции в README, хотя таблица его возможность обещает; и указатель «See the README» вёл в пустоту. Здесь всё три закрыты, кода не возвращено.

1. A doc comment outlived its method

The extraction removed the method and kept its <summary>, which C# then binds to the next member regardless of the blank line:

/// <summary>
/// The dominator tree of the whole live graph, with retained sizes. …
/// </summary>

public void Dispose()

So the file advertised, on Dispose(), precisely the capability the extraction had removed. Deleted.

2. RetentionPath had no README section

It was the only one of the four runtime tools without one, while README.md:27 kept advertising "Heap analysis (retained, duplicates, retention paths) — ClrMD" in the stack table:

tool section before after
LeakHarness ✅ §4.1
DuplicateDetector ✅ cat. 11
PropertyChangedStorm ✅ cat. 6
RetentionPath none

The new section covers what the two verbs answer and why the order matters — census first, because ClrHeap.EnumerateObjects() returns uncollected garbage too and a big heap is not evidence of a leak; then roots, with the field names that turn "this object is alive" into "this field is holding it".

Deliberately weighted toward the parts that constrain trust rather than advertise:

  • percentages are shares of the resolved sample, never of the population;
  • the verdict is computed over every instance, so no display budget (--sample, --max-hops) can move the diagnosis or the exit code;
  • a [stack] root is liveness, not retention;
  • the type matcher refuses System.Func<…GTDGoody…> because it once confidently reported a 2-hop path to the wrong object;
  • attaching suspends the target — on a multi-GB heap, take a dump.

Plus the exit-code table and why exit 2 is a tier of its own, cross-linked to docs/runtime-witness-operations.md.

Layout and Status were missing the tool too; both now name it, and Status records the dominator tree under Deferred instead of leaving it unmentioned.

3. The dangling pointer

Heap.cs:34 said "See the README" about the dominator tree and the README had nothing to see. It now points at a section that exists, states plainly that dominance is not implemented here, and sends anyone wanting the reasoning to #334, where the extracted implementation's argument is recorded.

Одна поправка к самому #334

Issue поместил dangling pointer в Program.cs. Он в Heap.cs:34. Program.cs тоже упоминает dominator tree, но как ремарку без перекрёстной ссылки, поэтому править там нечего. Записываю, потому что issue писал я, и ошибка в нём — моя.

Тип изменения

  • docs — документация
  • fix — исправление бага (осиротевший XML-комментарий документировал не тот член)

Как проверено

  • dotnet build audit/runtime/RetentionPath -c Release → 0 warnings, 0 errors
  • RetentionPath selftest → 16/16
  • python audit/runtime/ingest.py --selftest → 26/26
  • python tests/run_tests.py → exit 0, wpf 28/28
  • проверил программно, что у всех четырёх runtime-инструментов теперь есть секция в README, и что Dominators.cs не вернулся

Связанные issue

Closes #334. Refs #280 (closed as superseded), #309, 0753a45.

Чеклист

  • изменение покрыто существующими селфтестами (правка документационная; удаление комментария проверено сборкой)
  • README/docs обновлены — в этом и состоит изменение
  • коммит в conventional-commit стиле

Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Added documentation for the runtime retention witness and its census and roots commands.
    • Explained retained versus uncollected heap results, sampled root-path reporting, type matching, attach behavior, exit codes, and runtime.json integration.
    • Updated status information to mark retention analysis as complete and dominator-tree analysis as deferred.
    • Clarified current limitations in retention-path tooling.

…the comment that outlived its method

The remainder PR #280 left behind (#334). Three items, no code restored.

**1. A doc comment outlived its method.** `0753a45` extracted the witness "minus
the dominator tree" and removed the method but kept its `<summary>`, which C#
then bound to the next member regardless of the blank line. `Dispose()` was
documented as *"the dominator tree of the whole live graph, with retained
sizes"* — the file advertising the one capability the extraction removed. Deleted.

**2. `RetentionPath` was the only runtime tool with no README section**, while
`README.md:27` kept advertising *"Heap analysis (retained, duplicates, retention
paths) — ClrMD"* in the stack table. It now has one, covering what the two verbs
answer and why the split matters: `census` first, because
`ClrHeap.EnumerateObjects()` returns uncollected garbage too and a big heap is
not evidence of a leak; then `roots`, with the field names that turn "this object
is alive" into "this field is holding it".

Including the parts that constrain trust rather than advertise: shares are shares
of the RESOLVED SAMPLE and never of the population; the verdict is computed over
every instance so no display budget can move it; a `[stack]` root is liveness,
not retention; the type matcher deliberately refuses `System.Func<…GTDGoody…>`
because it once confidently reported a 2-hop path to the wrong object. Plus the
exit-code table and why exit 2 is a tier of its own.

The Layout block and the Status list were both missing the tool as well; both now
name it, and Status records the dominator tree under **Deferred** rather than
leaving it unmentioned.

**3. The dangling pointer.** `Heap.cs:34` told the reader "See the README" about
the dominator tree, and the README had nothing to see. It now points at the
section that exists, says plainly that dominance is NOT implemented here, and
sends anyone who wants the reasoning to #334 — where the extracted
implementation's argument is recorded.

`Dominators.cs` is not restored, per the issue. The comment in the csproj that
names the exclusion stays; it is the record of a decision, and the only thing
wrong with it was that everything it pointed at was missing.

One correction to #334 itself: it located the dangling pointer in `Program.cs`.
It is in `Heap.cs:34`. `Program.cs` mentions the dominator tree too, but as an
aside without a cross-reference, so it needed nothing.

Verified: build 0 warnings / 0 errors, classifier selftest 16/16, ingest selftest
26/26, tests/run_tests.py wpf 28/28. Checked that all four runtime tools now have
a README section, and that no dominator code came back.

Closes #334.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Lmcv3X9PoELp8CGDfNc9m
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 63dd3076-9c29-4873-9692-ae0f2bf14a1c

📥 Commits

Reviewing files that changed from the base of the PR and between 7a63b73 and 754444d.

📒 Files selected for processing (2)
  • audit/runtime/README.md
  • audit/runtime/RetentionPath/Heap.cs

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The runtime documentation now describes the RetentionPath tool, its commands, output and exit-code contracts, limitations, and runtime status. Heap documentation no longer assigns the removed dominator-tree analysis to Dispose.

Changes

RetentionPath documentation

Layer / File(s) Summary
Document RetentionPath behavior and deferred analysis
audit/runtime/README.md, audit/runtime/RetentionPath/Heap.cs
Adds RetentionPath tooling, command and output documentation, runtime status details, and deferred-analysis notes. Removes the obsolete dominator-tree XML summary from Heap.cs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 75444

This PR updates runtime documentation and removes an obsolete comment without changing runtime behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main documentation updates and removal of the orphaned comment.
Description check ✅ Passed The description completes all required sections, explains the changes, references issues, and records validation results.
Linked Issues check ✅ Passed The changes satisfy issue #334 by fixing the orphaned comment, documenting RetentionPath, and resolving the dangling reference without restoring dominators.
Out of Scope Changes check ✅ Passed All changes remain within issue #334 scope and support the requested runtime documentation and comment corrections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/retentionpath-doc-remainder

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

@coderabbitai full review


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

@PhysShell I will perform a complete review of PR #335.

✅ Action performed

Full review finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RetentionPath: the remainder PR #280 left behind — an undocumented tool and a doc comment without its method

2 participants